<div class="wd-form">

<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id' => 'category-form',
	//'enableAjaxValidation' => true,
	'htmlOptions'=>array('enctype'=>'multipart/form-data','class'=>'well'),
)); ?>
	<fieldset>

		<p class="note">
			<?php echo Yii::t('app', 'Fields with'); ?> <span class="required">*</span> <?php echo Yii::t('app', 'are required'); ?>.
		</p>
	
		<div class="wd-input">
			<?php echo $form->labelEx($model,'name'); ?>
			<?php echo $form->textField($model, 'name', array('maxlength' => 128)); ?>
			<?php echo $form->error($model,'name'); ?>
			<script type="text/javascript" language="javascript">
				jQuery(document).ready(function() {
					$('#Category_name').keyup(function(){
						createAlias();
					});
					$('#Category_name').focusout(function(){
						createAlias();
					});
									
					function createAlias()
					{
						var value = $('#Category_name').val();
						value = value.replace(/[áàảãạăắằẳẵặâấầẩẫậ]/ig, 'a');
						value = value.replace(/[đ]/ig, 'd');
						value = value.replace(/[éèẻẽẹêếềểễệ]/ig, 'e');
						value = value.replace(/[íìỉĩị]/ig, 'i');
						value = value.replace(/[óòỏõọôốồổỗộơớờởỡợ]/ig, 'o');
						value = value.replace(/[úùủũụưứừửữự]/ig, 'u');
						value = value.replace(/[ýỳỷỹỵ]/ig, 'y');
						value = value.replace(/[^A-Za-z0-9\s_-]/ig, '');
						value = value.replace(/\s/ig, '-');
						value = value.toLowerCase();
						$('#Category_alias').val(value);
					}
				});
			</script>
		</div>
		<?php echo $form->hiddenField($model, 'alias', array('maxlength' => 128)); ?>
		
		<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'label'=>'Save')); ?>
		<?php echo CHtml::link('Cancel',array('users/categoryAuthor'), array('class'=>'btn')); ?>
	</fieldset>

<?php
$this->endWidget();
?>
</div><!-- form -->